package com.me.bbs.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.me.bbs.dto.ViewRecordDTO;
import com.me.bbs.entity.Post;
import com.me.bbs.entity.ViewRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author lm
 * @since 2023-01-09
 */
public interface ViewRecordMapper extends BaseMapper<ViewRecord> {
    Page<ViewRecordDTO> selectPageByUser(Page<ViewRecord> page, @Param(Constants.WRAPPER) Wrapper<ViewRecord> wrapper);

    @Select("select count(*) from view_record where post")
    Long selectTodayViewCountByForumId(@Param("forumId") Long id, @Param("date")LocalDateTime dateTime);
}
